package com.minimalist.common.entity.lindi.vo.purchaseindexrecord;

import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.minimalist.common.config.convert.LongArrJsonSerializer;
import com.minimalist.common.entity.basic.vo.file.FileVO;
import com.minimalist.common.entity.lindi.vo.purchasetownindex.LindiPurchaseTownIndexVO;
import com.minimalist.common.utils.Update;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;

/**
 * @author 11987
 */

@Schema(name = "林地指标平台_购买指标记录实体")
public class LindiPurchaseIndexRecordVO implements Serializable{
    @Serial
    private static final long serialVersionUID = 1L;

    @NotNull(message = "购买指标记录ID不能为空", groups = {Update.class})
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "purchaseIndexRecordId", description = "购买指标记录ID", type = "string")
    private Long purchaseIndexRecordId;

    @Schema(name = "purchaseIndexRecordCode", description = "编号", type = "string")
    private String purchaseIndexRecordCode;

    @Valid
    @Schema(name = "purchaseItems", description = "购买项目列表")
    private List<LindiPurchaseTownIndexVO> purchaseItems;

    @Schema(name = "purchaseTime", description = "购买时间", type = "string")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    private LocalDateTime purchaseTime;

    @JsonSerialize(using = LongArrJsonSerializer.class)
    @Schema(name = "fileIds", description = "文件ID列表")
    private List<Long> fileIds;

    @Schema(name = "files", description = "文件列表")
    private List<FileVO> files;

    @Schema(name = "remark", description = "备注", type = "string")
    private String remark;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "createId", description = "创建人ID", type = "string")
    private Long createId;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "updateId", description = "更新人ID", type = "string")
    private Long updateId;

    @Schema(name = "createTime", description = "创建时间", type = "string")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    private LocalDateTime createTime;

    @Schema(name = "updateTime", description = "更新时间", type = "string")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    private LocalDateTime updateTime;

    public LindiPurchaseIndexRecordVO(){
    }

    public Long getPurchaseIndexRecordId(){
        return purchaseIndexRecordId;
    }

    public void setPurchaseIndexRecordId(Long purchaseIndexRecordId){
        this.purchaseIndexRecordId = purchaseIndexRecordId;
    }

    public String getPurchaseIndexRecordCode(){
        return purchaseIndexRecordCode;
    }

    public void setPurchaseIndexRecordCode(String purchaseIndexRecordCode){
        this.purchaseIndexRecordCode = purchaseIndexRecordCode;
    }

    public List<LindiPurchaseTownIndexVO> getPurchaseItems(){
        return purchaseItems;
    }

    public void setPurchaseItems(List<LindiPurchaseTownIndexVO> purchaseItems){
        this.purchaseItems = purchaseItems;
    }

    public LocalDateTime getPurchaseTime(){
        return purchaseTime;
    }

    public void setPurchaseTime(LocalDateTime purchaseTime){
        this.purchaseTime = purchaseTime;
    }

    public List<Long> getFileIds(){
        return fileIds;
    }

    public void setFileIds(List<Long> fileIds){
        this.fileIds = fileIds;
    }

    public List<FileVO> getFiles(){
        return files;
    }

    public void setFiles(List<FileVO> files){
        this.files = files;
    }

    public String getRemark(){
        return remark;
    }

    public void setRemark(String remark){
        this.remark = remark;
    }

    public Long getCreateId(){
        return createId;
    }

    public void setCreateId(Long createId){
        this.createId = createId;
    }

    public Long getUpdateId(){
        return updateId;
    }

    public void setUpdateId(Long updateId){
        this.updateId = updateId;
    }

    public LocalDateTime getCreateTime(){
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime){
        this.createTime = createTime;
    }

    public LocalDateTime getUpdateTime(){
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime){
        this.updateTime = updateTime;
    }

    @Override
    public boolean equals(Object o){
        if (this == o){
            return true;
        }
        if (o == null || getClass() != o.getClass()){
            return false;
        }
        LindiPurchaseIndexRecordVO that = (LindiPurchaseIndexRecordVO) o;
        return Objects.equals(purchaseIndexRecordId, that.purchaseIndexRecordId) && Objects.equals(purchaseIndexRecordCode, that.purchaseIndexRecordCode) && Objects.equals(purchaseItems, that.purchaseItems) && Objects.equals(purchaseTime, that.purchaseTime) && Objects.equals(fileIds, that.fileIds) && Objects.equals(files, that.files) && Objects.equals(remark, that.remark) && Objects.equals(createId, that.createId) && Objects.equals(updateId, that.updateId) && Objects.equals(createTime, that.createTime) && Objects.equals(updateTime, that.updateTime);
    }

    @Override
    public int hashCode(){
        return Objects.hash(purchaseIndexRecordId, purchaseIndexRecordCode, purchaseItems, purchaseTime, fileIds, files, remark, createId, updateId, createTime, updateTime);
    }
}
